package search;

import java.sql.*;
import java.util.ArrayList;
import java.util.List;

import mysql.JdbcUtil;
import servlet.recipe.control.Recipe_rsp;

public  class SearchRecipes implements Search {
    SearchMQL searchMQL=new SearchMQL();
    String sql;

    /***
     *
     * @return 返回所有菜谱
     * @throws SQLException 抛出Sql异常
     */
    @Override
    public List<Recipe> searchAll()throws SQLException{
        sql = "SELECT * FROM recipes";
        return searchMQL.mysqlSearch(sql);
    }
    @Override
    /***
     *
     * @param recipe_id
     * @return 返回搜索的菜谱
     * @throws SQLException
     */
    public List<Recipe> recipes(String recipe_id) throws SQLException {
        sql = "SELECT * FROM recipes WHERE recipe_id="+recipe_id;
        return searchMQL.mysqlSearch(sql);
    }
}
